<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/6/18 0018
 * Time: 16:44
 */
header("Content-Type:application/json;charset=utf-8");
if ($_SERVER["REQUEST_METHOD"]!="POST"){
    $result=array("msg"=>"不支持get请求","status"=>-1);
    print_r(json_encode($result));
    return;
}
//post请求
if (!(isset($_POST["utelphone"])&&$_POST["upwd"])){
    $result=array("msg"=>"手机号或密码不能为空","status"=>-2);
    print_r(json_encode($result));
    return;
}
$utelphone=$_POST["utelphone"];
$upwd=$_POST["upwd"];
include "DBheuper.php";
$sql="SELECT `u_id`,`u_telphone` FROM userinfo WHERE u_telphone='".$utelphone."' AND u_pwd='".$upwd."'";
//4.执行sql语句
$resultData=sqlQuery($sql);

//5.判断结果
if ($resultData->num_rows>=1){
    session_start();
    $userData=$resultData->fetch_assoc();
    $_SESSION["userinfo"]=$userData;
    $result=array("msg"=>"登录成功","status"=>1,"data"=>$userData);
    print_r(json_encode($result));
}else{
    $result=array("msg"=>"登录失败","status"=>-3);
    print_r(json_encode($result));
}




